/**
 * Check if a path is an external link
 * @param {string} path
 * @returns {boolean}
 */
export function isExternal(path: string): boolean {
  return /^(https?:|mailto:|tel:)/.test(path);
}

/**
 * Check if a username is valid
 * @param {string} str
 * @returns {boolean}
 */
export function validUsername(str: string): boolean {
  const valid_map: string[] = ['admin', 'editor'];
  return valid_map.indexOf(str.trim()) >= 0;
}
